<template>
  <div>
    login
    <UButton
      @click="hadnleClickChangeLayout"
    >
      切换布局
    </UButton>
    <!-- <form @submit.prevent="login">
      <input v-model="credentials.email" type="email" placeholder="电子邮件" />
      <input v-model="credentials.password" type="password" placeholder="密码" />
      <button type="submit">登录</button>
    </form> -->
  </div>
</template>

<script setup lang="ts">
definePageMeta({
  layout: false,
  title: '登录',
  description: '登录页面' 
})

// const { loggedIn, user, fetch: refreshSession } = useUserSession()
// const credentials = reactive({
//   email: '',
//   password: ''
// })
// async function login() {
//   $fetch('/api/login', {
//     method: 'POST',
//     body: credentials
//   })
//     .then(async() => {
//     // 在客户端刷新会话并重定向到主页
//       await refreshSession()
//       await navigateTo('/')
//     })
//     .catch(() => alert('凭据错误'))
// }

const clickable = ref(false)

const hadnleClickChangeLayout = () => {
  clickable.value = !clickable.value 
  if (!clickable.value) {
    setPageLayout(false)  
  } else setPageLayout('default')
}
</script>

<style scoped>

</style>